# Contributor: Paul Kilar <pkilar@gmail.com>
# Maintainer: Paul Kilar <pkilar@gmail.com>
pkgname=dante
pkgver=1.4.2
pkgrel=3
pkgdesc="Dante is SOCKS server and a SOCKS client"
url="https://www.inet.no/dante/"
arch="all"
license="BSD-3-Clause"
makedepends="bison flex"
install="$pkgname-server.pre-install"
subpackages="$pkgname-dev $pkgname-doc $pkgname-server"
source="http://www.inet.no/dante/files/dante-$pkgver.tar.gz
	ifdev.patch
	sockd.initd
	sockd.confd
	"

prepare() {
	default_prepare
	update_config_guess
}

build() {
	subpackages="$pkgname-dev $pkgname-doc"
	ac_cv_func_sched_setscheduler=no ./configure --prefix=/usr
	make
}

package() {
	make install DESTDIR=$pkgdir
}

server() {
	depends=
	cd "$builddir"
	install -D -m644 "example/sockd.conf"  "$subpkgdir/etc/sockd.conf"
	install -D -m644 "$srcdir"/sockd.confd "$subpkgdir"/etc/conf.d/sockd
	install -D -m755 "$srcdir"/sockd.initd "$subpkgdir"/etc/init.d/sockd

	install -d "$subpkgdir/usr/sbin"
	mv "$pkgdir/usr/sbin/sockd" "$subpkgdir/usr/sbin/sockd"
}

sha512sums="4d0588d3e138c80fac7ecf80a2d0ab0a2a3e7c9c847029af4eb50b59f35c86641085bf8e625d437cbb00d616ac444b98fdcf417da375fe32312ca420187ef21b  dante-1.4.2.tar.gz
9fd824db09081e1ff81875e740c9ee4d529e986ce486cbb4270e02c061c0120898cbe57f70ed010cc6b81f1d700114732d8f84b2f055f43d5f3110f2f0e8ba23  ifdev.patch
9ec0c32f6bfb3fbd266f89ccb0ffff0356b88d679bf3099ff4c78e7f4ca78de9b8fb9f6ff136ca333f148c16f9fcb502ac3f5469c106494846e4aa3192d79c4e  sockd.initd
09b744340c03369983a9b07e50215288e5a43d15497db479867132bee46f34a7a8e451c980e064f751ad50e5231d77fa5ae9fd5cf2efe3274ae50168bfceaa67  sockd.confd"
